package com.zlsy.secondtime.threadcoreknowledge.threadobjectclasscommonmethods;

/**
 * @author zhouliang
 * @date 2020/5/18 19:19
 *
 *  演示打印 main 、thread-0 、thread-1的情况
 */
public class CurrentThread implements Runnable{


    /**
     * 证明：Thread.currentThread()是返回当前执行线程的引用
     * @param args
     */
    public static void main(String[] args) {
        new CurrentThread().run();

        new Thread(new CurrentThread()).start();

        new Thread(new CurrentThread()).start();
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
